<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>

<!--{if $_G['adminid'] == 1}-->
<link id="style_css" rel="stylesheet" type="text/css" href="{STATICURL}topic/t1/style.css?{VERHASH}">
<style id="diy_style" type="text/css"></style>
<!--{/if}-->

<div class="zhenti">
<div class="xuanchuan"></div>
<div class="kechengbiao">

	<table class="biaoge">
	  <tr class="biaoti">
	    <td colspan="8"  align="center">
	    <span id="timeyear"></span>
	    <span id="timestday"></span> 至
	    <span id="timeenday"></span>
	    <span>课程安排报名表</span></td>
	  </tr>
	  <tr align="center" class="xingqibiao">
	    <td>星期/时间<br>week/time</td>
	    <td class="xingqi">星期一<br>Monday</td>
	    <td class="xingqi">星期二<br>Tuesday</td>
	    <td class="xingqi">星期三<br>Wednesday</td>
	    <td class="xingqi">星期四<br>Thursday</td>
	    <td class="xingqi">星期五<br>Friday</td>
	    <td class="xingqi">星期六<br>Saturday</td>
	    <td class="xingqi">星期日<br>Sunday</td>
	  </tr>
	<tr>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
		<td style="height:30px; "></td>
	</tr>
	  <tr class="shangwu">
	    <td class="shijianduan" style="font-size:1.5em; border:2px solid #fff; ">上午<br>forenoon</td>
	    <td class="kechengneirong "><!--[diy=diy1]--><div id="diy1" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=93"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy2]--><div id="diy2" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=85"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy3]--><div id="diy3" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=89"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy4]--><div id="diy4" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=65"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy5]--><div id="diy5" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=69"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy6]--><div id="diy6" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=73"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy7]--><div id="diy7" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=77"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	  </tr>
	  <tr class="zhongwu">
	    <td class="shijianduan" style="font-size:1.5em; border:2px solid #fff; ">中午<br>noon</td>
	    <td class="kechengneirong "><!--[diy=diy8]--><div id="diy8" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=82"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy9]--><div id="diy9" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=86"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy10]--><div id="diy10" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=90"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy11]--><div id="diy11" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=66"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy12]--><div id="diy12" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=70"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy13]--><div id="diy13" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=74"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy14]--><div id="diy14" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=78"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	  </tr>
	  <tr class="xiawu">
	    <td class="shijianduan" style="font-size:1.5em; border:2px solid #fff; ">下午<br>afternoon</td>
	    <td class="kechengneirong "><!--[diy=diy15]--><div id="diy15" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=83"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy16]--><div id="diy16" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=87"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy17]--><div id="diy17" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=91"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy18]--><div id="diy18" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=67"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy19]--><div id="diy19" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=71"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy20]--><div id="diy20" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=75"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy21]--><div id="diy21" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=79"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	  </tr>
	  <tr class="wanshang">
	    <td class="shijianduan" style="font-size:1.5em; border:2px solid #fff; ">晚上<br>evening</td>
	    <td class="kechengneirong "><!--[diy=diy22]--><div id="diy22" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=84"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy23]--><div id="diy23" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=88"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy24]--><div id="diy24" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=92"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy25]--><div id="diy25" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=68"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy26]--><div id="diy26" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=72"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy27]--><div id="diy27" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=76"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	    <td class="kechengneirong "><!--[diy=diy28]--><div id="diy28" class="area"></div><!--[/diy]--><!--{if $_G['adminid'] == 1}--><a href="/forum.php?mod=forumdisplay&fid=80"><span class="xinzeng">新增<!--{/if}--></span></a></td>
	  </tr>
	</table>

</div>
</div>

<script type="text/javascript">
  jQuery(function(){


    var mydate = new Date();
    var year = mydate.getFullYear();
    var month = mydate.getMonth()+1;
    var y = mydate.getFullYear();
    var m = mydate.getMonth()+1;
    var d = mydate.getDate();
    var dangqianzhou = 1;

    var week; 
    if(new Date().getDay()==0) week="星期日"
    if(new Date().getDay()==1) week="星期一"
    if(new Date().getDay()==2) week="星期二" 
    if(new Date().getDay()==3) week="星期三"
    if(new Date().getDay()==4) week="星期四"
    if(new Date().getDay()==5) week="星期五"
    if(new Date().getDay()==6) week="星期六"

    	

    function obaganlestyle(snum,lnum)
        {
            var myDate = new Date();
            var day = myDate.getDay();//返回0-6
            //var today = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
            //当天的日期
        	var endday;
        	var startday;

            endday = getthisDay(-day + lnum); //算得周日
            startday = getthisDay(-day + snum);//算的周一
            
            jQuery('#timestday').html(startday);
            jQuery('#timeenday').html(endday);

            //全局变量获取时间字符串转为整数型 后面调用对比
            theendday = parseInt(gettheDay(-day + lnum));
            thestartday = parseInt(gettheDay(-day + snum));


        }
        //取得日期
        function getthisDay(day) {
            var today = new Date();
            var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
            today.setTime(targetday_milliseconds); //关键换算
            var tyear = today.getFullYear();
            var tMonth = today.getMonth();
            var tDate = today.getDate();
            if (tDate < 10) {
                tDate = "0" + tDate;
            }
            tMonth = tMonth + 1;
            if (tMonth < 10) {
                tMonth = "0" + tMonth;
            }
            return  tMonth + "月" + tDate + "日";
        }

        function gettheDay(day) {
            var today = new Date();
            var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
            today.setTime(targetday_milliseconds); //关键换算
            var tyear = today.getFullYear();
            var tMonth = today.getMonth();
            var tDate = today.getDate();
            if (tDate < 10) {
                tDate = "0" + tDate;
            }
            tMonth = tMonth + 1;
            if (tMonth < 10) {
                tMonth = "0" + tMonth;
            }
            return  tMonth + tDate;
        }


    obaganlestyle(1, 7);
    jQuery("#timeyear").html(year+"年"); 


    //对应星期色块动态改变
    if(new Date().getDay()==0){
      jQuery(".xingqi:contains('星期日')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(7),.zhongwu td:eq(7),.xiawu td:eq(7),.wanshang td:eq(7)").css("background", "#CC9900");
    } 
    if(new Date().getDay()==1){
      jQuery(".xingqi:contains('星期一')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(1),.zhongwu td:eq(1),.xiawu td:eq(1),.wanshang td:eq(1)").css("background", "#CC9900");
    } 
    if(new Date().getDay()==2){
      jQuery(".xingqi:contains('星期二')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(2),.zhongwu td:eq(2),.xiawu td:eq(2),.wanshang td:eq(2)").css("background", "#CC9900");
    } 
    if(new Date().getDay()==3){
      jQuery(".xingqi:contains('星期三')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(3),.zhongwu td:eq(3),.xiawu td:eq(3),.wanshang td:eq(3)").css("background", "#CC9900");
    } 
    if(new Date().getDay()==4){
      jQuery(".xingqi:contains('星期四')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(4),.zhongwu td:eq(4),.xiawu td:eq(4),.wanshang td:eq(4)").css("background", "#CC9900");
    } 
    if(new Date().getDay()==5){
      jQuery(".xingqi:contains('星期五')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(5),.zhongwu td:eq(5),.xiawu td:eq(5),.wanshang td:eq(5)").css("background", "#CC9900");
    } 
    if(new Date().getDay()==6){
      jQuery(".xingqi:contains('星期六')").css("color", "#CC9900");
      jQuery(".shangwu td:eq(6),.zhongwu td:eq(6),.xiawu td:eq(6),.wanshang td:eq(6)").css("background", "#CC9900");
    } 
    	

    	// 遍历时间文件 进行对比 但是if后中断判断 暂时使用单个单元格判断
    	// jQuery(".times").each(function(){

    	// 	//获得课程表中的时间字符串转为整数型
    	// 	var HDshijian = jQuery(this).html();
    	// 	var Z_H_hou = HDshijian.match(/.*\-(.*)\-(.*) .*\:.*/);

    	// 	//在不够10的位数上面加0来配合 获取时间的0位
    	// 	function shijianzhengzhe(){
    	// 		if (Z_H_hou[1] < 10) {
    	// 		    Z_H_hou[1] = "0" + Z_H_hou[1];
    	// 		}
    	// 		if (Z_H_hou[2] < 10) {
    	// 		   Z_H_hou[2] = "0" + Z_H_hou[2];
    	// 		}
    	// 		return  parseInt(Z_H_hou[1] + Z_H_hou[2]);
    	// 	}

    	// 	var shijianzhengzhe = shijianzhengzhe();
    		

    	// 	//月份问题依然存在
    	// 	if(shijianzhengzhe < thestartday && shijianzhengzhe > theendday) {
    	// 		jQuery('.times').parent().parent().parent().parent().parent().parent().parent().parent().css({'display':'none'});
    	// 		alert("11111111");
    	// 	}

    	// 	// alert(shijianzhengzhe)
    	// 	// alert(thestartday)
    	// 	// alert(theendday)
    	// 	// alert(shijianzhengzhe+theendday+thestartday)
    	// })
	
	//检查帖子时间函数
	function jianchashijian(name){

			var HDshijian = jQuery(name).html();
			var Z_H_hou = HDshijian.match(/.*\-(.*)\-(.*) .*\:.*/);

			function shijianzhengzhe(){
				if (Z_H_hou[1] < 10) {
				    Z_H_hou[1] = "0" + Z_H_hou[1];
				}
				if (Z_H_hou[2] < 10) {
				   Z_H_hou[2] = "0" + Z_H_hou[2];
				}
				return  parseInt(Z_H_hou[1] + Z_H_hou[2]);
			}

			var shijianzhengzhe = shijianzhengzhe();

			if(shijianzhengzhe < thestartday) {	
				jQuery(name).parent().parent().parent().parent().parent().parent().parent().parent().css({'display':'none'});
			}else if(shijianzhengzhe > theendday) {
				jQuery(name).parent().parent().parent().parent().parent().parent().parent().parent().css({'display':'none'});
			}

			// alert(shijianzhengzhe)
			// alert(thestartday)
			// alert(theendday)
			// alert(name)
	}
	
	for (var i = 1; i < 28; i++) {
			var name = '.times'+i;
			jianchashijian(name)
	}
	//循环执行上面的函数 在每一个对应的div上面  在里层循环 在用通用class会出现批量删除的bug
	//可以尝试循环28次 在diy[i]里面去找 class 然后修改本div的 css
});

</script>
<script type="text/javascript">
	
	//获取星期一的日期

	//获取星期天的日期
	//通过正则表达式  获取字符串  转换数字型  当前课程的日期
	//对比星期一的日期 大于这个日期 并且小于 星期天的这个日期 范围内显示 否则清空

</script>